import numpy as np
import matplotlib.pyplot as plt

def makeplot(stock_df,field,my_str,avg=0):
    column = getattr(stock_df,field)

    if avg:    # 当 avg不为0时
        column = column.rolling(avg,min_periods=1).mean()   # 绘制移动平均线

    column = np.array(column,dtype='float')
    date = np.array(stock_df.Date)
    plt.plot(date, column, label=my_str)
    plt.legend()



